<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <button  type="button" @click="testAAA">123</button>
    <button type="button" @click="testBBBB">345</button>

  </div>
</template>

<script>
  import request from '@/utils/request'
  import { getToken } from '@/utils/auth'
export default {
  name: 'index',
  data () {
    return {
      msg: '首页'
    }
  },
  methods:{
    testAAA(){
      alert("AA")
      let ss=  request({
        url: 'api/login?username=admin&password=123456',
        method: 'post',
        // data:{access_token:'3677ce45-2da7-4209-8f3d-16b7737f4683'}
      })
      // console.log(ss)
    },
    testBBBB(){
      alert("BB")
      window.location = "http://localhost:7901/oauth/authorize?client_id=client_2&response_type=code&redirect_uri=http://baidu.com";
      // let ss=  request({
      //   url: 'api/oauth/authorize?client_id=client_2&response_type=code&redirect_uri=http://baidu.com&scope=select',
      //   method: 'get',
      //   // data:{access_token:'3677ce45-2da7-4209-8f3d-16b7737f4683'}
      // })
      // console.log(ss)
    }
  },
  mounted:function(){
    // if(getToken()){
    //   this.loading = true
    //   this.$store.dispatch('getMenu',111).then(() => {
    //     this.loading = false
    //   }).catch(() => {
    //     this.loading = false
    //   })
    // }
    // else {
    //   alert(2222)
    //   this.$router.push({ path: '/login' })
    // }



  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
